package com.isoft.controller;
import com.isoft.pojo.dto.LifecycleRecordQueryDTO;
import com.isoft.pojo.vo.LifecycleRecordVO;
import com.isoft.result.CycPageResult;
import com.isoft.result.Result;
import com.isoft.service.LifecycleRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "生命周期接口")
@RestController
@RequestMapping("/admin/lifecycle")
@Slf4j
public class LifecycleRecordController {
    @Autowired
    private LifecycleRecordService lifecycleRecordService;
    /**
     * 分页查询生命周期记录
     * @param lifecycleRecordQueryDTO
     * @return
     */
    @GetMapping("/records")
    @Operation(summary = "分页查询生命周期记录")
    public Result<CycPageResult> pageLifecycleRecord(@Valid @ParameterObject LifecycleRecordQueryDTO lifecycleRecordQueryDTO){
        log.info("分页查询生命周期记录：{}", lifecycleRecordQueryDTO);
        CycPageResult<LifecycleRecordVO> cycPageResult = lifecycleRecordService.pageLifecycleRecord(lifecycleRecordQueryDTO);
        return Result.success(cycPageResult);
    }
}
